package tool.data;

import tool.analysis.IVariableAndParameterAnalyser;

	/**
	 * @author jwb09119
	 * @date 2013/11/22
	 * 
	 * This class represents a parsed method parameter from Java source code.  It is a data wrapper,
	 * but has high semantic cohesion.
	 * 
	 * This was formerly a inner class of VariableVisitor, pulled out as the class was getting
	 * too crowded.
	 */

public class ParameterRecord {

	private String name;
	private TypeDefinition type;
	private boolean isArray;
	
	
	// Constructor
	public ParameterRecord (String name, TypeDefinition type) {
			
	    this.name = name;
	    this.type = type;
	    
	}


    public String getName() {
		
		return new String(name);
		
	}

	
	public String getFullTypeName() {
		
		return type.getNameWithPath();
		
	}

	
	public boolean isArray() {
		
		return isArray;
		
	}

	
	public void setIsArray(boolean isArray) {
		
		this.isArray = isArray;
		
	}
	
	
	@Override
	public String toString () {
		
		return "\nParameter\nName: "+getName()+"\nType: "+getFullTypeName()+"\nIs Array: "+isArray();	
	
	}
	
	public void accept (IVariableAndParameterAnalyser visitor) {
	    
	    visitor.visit(this);
	    
	}
	
}
